<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>


<html:html>
<head>
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/stkissue2.css" />
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/common/css/stkissue/stkissue.css" />	
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/sampleForm.css" />
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/me.css" />
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/common/css/help/help.css" />
<script type="text/javascript" >
function returnToMainForm(lineNumber, itemOffset) {
	
	var	docNo	= 	document.getElementById("docNo"+itemOffset).innerHTML;
			
	opener.document.getElementById("docNo"+lineNumber).value = docNo;							
			
	window.close(); 
}
function colorOver() {
	
}
</script>

<style>

.odd{background-color:#fFA700; }
.even{background-color:#fFA700; }

.menu-over{background-color:#64b1ff;}

</style>

<script type="text/javascript" >

function modalWinItem(aa) {
	if (window.showModalDialog) {		
		window.showModalDialog(aa,"name","dialogTop:100px;dialogWidth:450px;dialogHeight:350px;center:yes");
	} else {		
		window.open(aa,'name','height=350,width=100,toolbar=no,directories=no,status=no,continued from previous linemenubar=no,scrollbars=no,resizable=no ,modal=yes');
	}
}
</script>
	
</head>

<body onload="document.getElementById('itemFind').focus();"><br />
<div id="wrapper">
	<!-- 
		<div id="header"><img src="images/kiuchilogo.png" width="305" height="80" /></div>
	 -->	 
	<div id="menu"><ul id="nav"></ul></div>
	  
	<div id="content">
		<div id="menuNav">			
			<a href="<%=request.getContextPath() %>/Login.do?mode=check" >หน้าหลัก</a> 
			>> คลังพัสดุ - Store กลาง  >> จัดซื้อ <br />
		
		>> <html:link action ="/purchaseOrder.do?mode=displayPO&isDyeChem=yes">ดูรายการใบ Purchase Order สีเคมี</html:link>
		>> <html:link action ="/purchaseOrder.do?mode=displayPO&isDyeChem=no">ดูรายการใบ Purchase Order ทั่วไป</html:link>
		>> <html:link action ="/purchaseOrder.do?mode=showFind">สร้าง PO จากใบ พ.1 (ขอซื้อผ่าน)</html:link>			
		</div>		<br />

					
		<div style="background: #ffffff;">	
	<center>
		<div>			
			<html:form action="/purchaseOrder.do?mode=showFind">
				ค้นหา เลขที่เอกสาร พ.1(หรือรายละเอียด):<html:text property="itemFind" value="${itemFind}" styleId="itemFind" />
				แสดงผลต่อหน้า:<html:select property="maxEntriesPerPage" value="${maxEntriesPerPage}">
							<html:option value="5">5 รายการ</html:option>
							<html:option value="10">10 รายการ</html:option>							
							<html:option value="20">20 รายการ</html:option>
							<html:option value="50">50 รายการ</html:option>							
						  </html:select>
				<html:submit value="ค้นหา" />
			</html:form>						
		</div>
		<div>
		<table border="1" width="95%">
			<tr><td colspan="3" >ค้นหา <font color="red"><b>${itemFind}</b></font> ->  ${allElement } ระเบียน</td>
				<td colspan="3" align="right">หน้า ${currentPage }/${lastPage }</td>
			</tr>
			<tr><td colspan="6">
					<logic:empty name="firstPage">หน้าแรก</logic:empty>
					<logic:notEmpty name="firstPage">			
						<html:link action="/purchaseOrder.do?mode=showFind&page=${FirstPage }&itemFind=${itemFind }&maxEntriesPerPage=${maxEntriesPerPage }" >หน้าแรก</html:link>
					</logic:notEmpty>
					<logic:empty name="previousPage">ถอยหลัง</logic:empty>
					<logic:notEmpty name="previousPage">
						<html:link action="/purchaseOrder.do?mode=showFind&page=${previousPage }&itemFind=${itemFind }&maxEntriesPerPage=${maxEntriesPerPage }" >ถอยหลัง</html:link>					
					</logic:notEmpty>										
					<logic:empty name="nextPage">ถัดไป</logic:empty>
					<logic:notEmpty name="nextPage">						
						<html:link action="/purchaseOrder.do?mode=showFind&page=${nextPage }&itemFind=${itemFind }&maxEntriesPerPage=${maxEntriesPerPage }" >ถัดไป</html:link>
					</logic:notEmpty>										
					<logic:empty name="lastPage">หน้าสุดท้าย</logic:empty>
					<logic:notEmpty name="lastPage">
						<html:link action="/purchaseOrder.do?mode=showFind&page=${lastPage }&itemFind=${itemFind }&maxEntriesPerPage=${maxEntriesPerPage }" >หน้าสุดท้าย</html:link>
					</logic:notEmpty>
											
				</td>
			</tr>
			<tr class="odd">
				<td width="5%">ลำดับ</td>
				<td width="17%">โหมด</td>
				<td width="18%">เลขที่เอกสาร พ.1</td>
				
				<td width="60%" colspan="3">รายละเอียด</td>
						
			</tr>
			
			
			<logic:notEmpty name="itemResults">
				<logic:iterate id="var" name="itemResults" indexId="id">

						<tr onmouseover="this.className='menu-over'" 
							onmouseout="this.className='even'" class="even">
							<td width="5%"> ${id+1+offset }.</td>																		
							<td width="17%">
							
								<c:if test="${var.ittl_status==0 }"> 
									<!--<a href="/ittl/purchaseOrder/purchaseOrder.do?mode=create&docNo=${var.stkReqNo}">สร้างใบ PO</a>
									--><a href="/ittl/purchaseOrder/purchaseOrder.do?mode=create3&docNo=${var.stkReqNo}">สร้างใบ PO</a>
								</c:if> 
								 
								<c:if test="${var.ittl_status==1 }">
									<!--<a href="/ittl/purchaseOrder/purchaseOrder.do?mode=edit&docNo=${var.docNo }">แก้ไข</a> |
									<a href="/ittl/purchaseOrder/purchaseOrder.do?mode=cancel&docNo=${var.docNo }">ยกเลิก</a> |
									--><a href="/ittl/purchaseOrder/purchaseOrder.do?mode=edit3&docNo=${var.docNo }">แก้ไข</a> | 						
									<a href="/ittl/purchaseOrder/purchaseOrder.do?mode=cancel3&docNo=${var.docNo }">ยกเลิก</a> | 	
									<a href="/ittl/purchaseOrder/purchaseOrder.do?mode=print&docNo=${var.docNo }" target="_blank">Print</a>
									<br /><br />สถานะ: ทำPOแล้ว<br />โดย ${var.docNo }
								</c:if>
								<c:if test="${var.ittl_status==2 }">สถานะ: ซื้อแล้ว<br />โดย ${var.docNo }<br /></c:if>
																								
							</td>					
							<td width="18%">
								<label id="docNo${id+1+offset }" >${var.stkReqNo }</label><br /><br />
								
							</td>
						
										<td width=33%">${var.itemName }&nbsp;</td>
										<td width=9%" align="right">${var.qty }&nbsp;</td>		
										<td width=9%">${var.ittl_unitName }&nbsp;</td>						
										
												
						</tr>
				</logic:iterate> 
			</logic:notEmpty>
		</table>
		
		</div>
	</center>
					

<input type="hidden" value="${monthFind }" id="monthFindId">
<script type="text/javascript">

	var item2 = document.getElementById("monthFindId").value;	
	document.formSearch.monthFind[item2-1].selected=true;
	
</script>


</div>
</div>
</body>

</html:html>